/*
 * Copyright (c) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "timeline_service_test.h"

#include <iostream>
#include <chrono>
#include <thread>
#include <gtest/gtest.h>
#include <if_system_ability_manager.h>
#include <ipc_skeleton.h>
#include <string_ex.h>

#include "sensor_if.h"
#include "timeline_common.h"
#include "timeline_client.h"
#include "timeline_manager.h"

using namespace testing::ext;
using namespace OHOS::Msdp;
using namespace OHOS;
using namespace std;
    
void TimelineTest::TimelineTestCallback::OnTimelineChanged(const TimelineDataUtils::TimelineData& timelineData)
{
    GTEST_LOG_(INFO) << "TimelineTestCallback area: " << timelineData.area;
    GTEST_LOG_(INFO) << "TimelineTestCallback value: " << timelineData.value;
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test subscribe
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback001, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback001: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    sptr<ITimelineCallback> cb = new TimelineTestCallback();
    GTEST_LOG_(INFO) << "Start register";
    auto type = TimelineDataUtils::TimelineArea::AREA_HOME;
    timelineClient.Subscribe(type, cb);
    sleep(10);
    timelineClient.UnSubscribe(type, cb);
    GTEST_LOG_(INFO) << "Cancell register";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback001: fun is end");
    //sleep(10);
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test subscribe
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback002, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback002: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    sptr<ITimelineCallback> cb = new TimelineTestCallback();
    GTEST_LOG_(INFO) << "Start register";
    auto type = TimelineDataUtils::TimelineArea::AREA_COMPANY;
    timelineClient.Subscribe(type, cb);
    
    sleep(10);
    timelineClient.UnSubscribe(type, cb);
    GTEST_LOG_(INFO) << "Cancell register";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback002: fun is end");
    //sleep(10);
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test subscribe
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback003, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback003: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    sptr<ITimelineCallback> cb = new TimelineTestCallback();
    GTEST_LOG_(INFO) << "Start register";
    auto type = TimelineDataUtils::TimelineArea::AREA_UNKNOWN;
    timelineClient.Subscribe(type, cb);    
    sleep(10);
    timelineClient.UnSubscribe(type, cb);
    GTEST_LOG_(INFO) << "Cancell register";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback003: fun is end");
    //sleep(10);
}


/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test kmeans
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback004, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback004: fun is start");
    //auto& timelineClient = TimelineClient::GetInstance();
    auto tlms = DelayedSpSingleton<TimelineService>::GetInstance();
    if (tlms == nullptr) {
        TIMELINE_HILOGE(TIMELINE_MODULE_SERVICE, "TimelineTestCallback004: service is null");
    }
    tlms->OnStart();
    tlms->GetTimelineManager()->ReadRecentOneMonthData();
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback004: fun is end");
    //sleep(10);
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetPositionState
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback005, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback005: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    auto ret = timelineClient.SetPositionState(1,0);
    EXPECT_TRUE(ret)<< "TimelineTestCallback005 fail to SetPositionState";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback005: fun is end");
    //sleep(10);
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetPositionState
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback006, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback006: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    auto ret = timelineClient.SetPositionState(2,0);
    EXPECT_FALSE(ret)<< "TimelineTestCallback006 fail to SetPositionState";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback006: fun is end");
    //sleep(10);
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetPositionState
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback007, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback007: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    auto ret = timelineClient.SetPositionState(0,1);
    EXPECT_TRUE(ret)<< "TimelineTestCallback007 fail to SetPositionState";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback007: fun is end");
    //sleep(10);
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetPositionState
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback008, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback008: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    auto ret = timelineClient.SetPositionState(0,2);
    EXPECT_FALSE(ret)<< "TimelineTestCallback008 fail to SetPositionState";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback008: fun is end");
    //sleep(10);
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetSleepTime 
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback009, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback009: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    int sleepTime_ = 20;
    int wakeupTime_ = 7;
    auto ret = timelineClient.SetSleepTime(sleepTime_,wakeupTime_);
    EXPECT_TRUE(ret)<< "TimelineTestCallback009 fail to SetPositionState";
    sleep(10);
    timelineClient.GetSleepTime();
    timelineClient.GetWakeupTime();
    EXPECT_TRUE(sleepTime_ == timelineClient.GetSleepTime())<< "TimelineTestCallback009 fail to get GetSleepTime";
    EXPECT_TRUE(wakeupTime_ == timelineClient.GetWakeupTime())<< "TimelineTestCallback009 fail to get GetWakeupTime";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback009: fun is end");
    //sleep(10);
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetSleepTime
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback010, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback010: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    int sleepTime_ = 24;
    int wakeupTime_ = 7;
    auto ret = timelineClient.SetSleepTime(sleepTime_,wakeupTime_);
    sleep(10);
    EXPECT_FALSE(ret)<< "TimelineTestCallback010 fail to SetPositionState";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback010: fun is end");
    //sleep(10);
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetSleepTime
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback011, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback011: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    int sleepTime_ = 20;
    int wakeupTime_ = 24;
    timelineClient.SetSleepTime(sleepTime_,wakeupTime_);
    auto ret = timelineClient.SetSleepTime(sleepTime_,wakeupTime_);
    sleep(10);
    EXPECT_FALSE(ret)<< "TimelineTestCallback011 fail to SetPositionState";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback011: fun is end");
    //sleep(10);
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetSleepTime
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback012, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback012: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    int sleepTime_ = 15;
    int wakeupTime_ = 15;
    timelineClient.SetSleepTime(sleepTime_,wakeupTime_);
    auto ret = timelineClient.SetSleepTime(sleepTime_,wakeupTime_);
    sleep(10);
    EXPECT_FALSE(ret)<< "TimelineTestCallback012 fail to SetPositionState";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback012: fun is end");
    //sleep(10);
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetHomePosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback013, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback013: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = 110;
    double latitude_ = 29;
    auto ret = timelineClient.SetHomePosition(longitude_,latitude_);
    EXPECT_TRUE(ret)<< "TimelineTestCallback013 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback013: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetHomePosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback014, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback014: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = 190;
    double latitude_ = 29;
    auto ret = timelineClient.SetHomePosition(longitude_,latitude_);
    EXPECT_FALSE(ret)<< "TimelineTestCallback014 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback014: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetHomePosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback015, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback015: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = -150;
    double latitude_ = 29;
    auto ret = timelineClient.SetHomePosition(longitude_,latitude_);
    EXPECT_TRUE(ret)<< "TimelineTestCallback015 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback015: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetHomePosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback016, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback016: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = -181;
    double latitude_ = 29;
    auto ret = timelineClient.SetHomePosition(longitude_,latitude_);
    EXPECT_FALSE(ret)<< "TimelineTestCallback016 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback016: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetHomePosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback017, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback017: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = 70;
    double latitude_ = 91;
    auto ret = timelineClient.SetHomePosition(longitude_,latitude_);
    EXPECT_FALSE(ret)<< "TimelineTestCallback017 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback017: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetHomePosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback018, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback018: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = 70;
    double latitude_ = -45;
    auto ret = timelineClient.SetHomePosition(longitude_,latitude_);
    EXPECT_TRUE(ret)<< "TimelineTestCallback018 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback018: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetHomePosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback019, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback019: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = 70;
    double latitude_ = -91;
    auto ret = timelineClient.SetHomePosition(longitude_,latitude_);
    EXPECT_FALSE(ret)<< "TimelineTestCallback019 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback019: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetCompanyPosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback020, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback020: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = 110;
    double latitude_ = 29;
    auto ret = timelineClient.SetCompanyPosition(longitude_,latitude_);
    EXPECT_TRUE(ret)<< "TimelineTestCallback020 fail to SetCompanyPosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback020: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetCompanyPosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback021, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback021: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = 190;
    double latitude_ = 29;
    auto ret = timelineClient.SetCompanyPosition(longitude_,latitude_);
    EXPECT_FALSE(ret)<< "TimelineTestCallback021 fail to SetCompanyPosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback021: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetCompanyPosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback022, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback022: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = -150;
    double latitude_ = 29;
    auto ret = timelineClient.SetCompanyPosition(longitude_,latitude_);
    EXPECT_TRUE(ret)<< "TimelineTestCallback022 fail to SetCompanyPosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback022: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetCompanyPosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback023, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback023: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = -181;
    double latitude_ = 29;
    auto ret = timelineClient.SetCompanyPosition(longitude_,latitude_);
    EXPECT_FALSE(ret)<< "TimelineTestCallback023 fail to SetCompanyPosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback023: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetCompanyPosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback024, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback024: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = 70;
    double latitude_ = 91;
    auto ret = timelineClient.SetCompanyPosition(longitude_,latitude_);
    EXPECT_FALSE(ret)<< "TimelineTestCallback024 fail to SetCompanyPosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback024: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetCompanyPosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback025, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback025: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = 70;
    double latitude_ = -45;
    auto ret = timelineClient.SetCompanyPosition(longitude_,latitude_);
    EXPECT_TRUE(ret)<< "TimelineTestCallback025 fail to SetCompanyPosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback025: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetCompanyPosition
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback026, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback026: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    double longitude_ = 70;
    double latitude_ = -91;
    auto ret = timelineClient.SetCompanyPosition(longitude_,latitude_);
    EXPECT_FALSE(ret)<< "TimelineTestCallback026 fail to SetCompanyPosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback026: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetRestTime
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback027, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback027: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    int32_t resttimestart_ = 19;
    int32_t resttimeend_ = 8;
    auto ret = timelineClient.SetRestTime(resttimestart_, resttimeend_);
    EXPECT_TRUE(ret)<< "TimelineTestCallback027 fail to SetHomePosition";
    timelineClient.GetRestTimeStart();
    timelineClient.GetRestTimeEnd();
    EXPECT_TRUE(resttimestart_ == timelineClient.GetRestTimeStart())<< "TimelineTestCallback027 fail to get GetRestTimeStart";
    EXPECT_TRUE(resttimeend_ == timelineClient.GetRestTimeEnd())<< "TimelineTestCallback027 fail to get GetRestTimeEnd";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback027: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetRestTime
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback028, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback028: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    int32_t resttimestart_ = 24;
    int32_t resttimeend_ = 8;
    auto ret = timelineClient.SetRestTime(resttimestart_, resttimeend_);
    sleep(10);
    EXPECT_FALSE(ret)<< "TimelineTestCallback028 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback028: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetRestTime
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback029, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback029: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    int32_t resttimestart_ = 14;
    int32_t resttimeend_ = 24;
    auto ret = timelineClient.SetRestTime(resttimestart_, resttimeend_);
    sleep(10);
    EXPECT_FALSE(ret)<< "TimelineTestCallback029 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback029: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetRestTime
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback030, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback030: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    int32_t resttimestart_ = 15;
    int32_t resttimeend_ = 15;
    auto ret = timelineClient.SetRestTime(resttimestart_, resttimeend_);
    sleep(10);
    EXPECT_FALSE(ret)<< "TimelineTestCallback030 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback030: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetWorkTime
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback031, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback031: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    int32_t worktimestart_ = 9;
    int32_t worktimeend_ = 17;
    auto ret = timelineClient.SetWorkTime(worktimestart_, worktimeend_);
    EXPECT_TRUE(ret)<< "TimelineTestCallback031 fail to SetHomePosition";
    timelineClient.GetWorkTimeStart();
    timelineClient.GetWorkTimeEnd();
    EXPECT_TRUE(worktimestart_ == timelineClient.GetWorkTimeStart())<< "TimelineTestCallback031 fail to get GetWorkTimeStart";
    EXPECT_TRUE(worktimeend_ == timelineClient.GetWorkTimeEnd())<< "TimelineTestCallback031 fail to get GetWorkTimeEnd";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback031: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetWorkTime
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback032, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback032: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    int32_t worktimestart_ = 24;
    int32_t worktimeend_ = 7;
    auto ret = timelineClient.SetWorkTime(worktimestart_, worktimeend_);
    sleep(10);
    EXPECT_FALSE(ret)<< "TimelineTestCallback032 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback032: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetWorkTime
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback033, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback033: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    int32_t worktimestart_ = 15;
    int32_t worktimeend_ = 24;
    auto ret = timelineClient.SetWorkTime(worktimestart_, worktimeend_);
    sleep(10);
    EXPECT_FALSE(ret)<< "TimelineTestCallback033 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback033: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test SetWorkTime
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback034, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback034: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    int32_t worktimestart_ = 7;
    int32_t worktimeend_ = 7;
    auto ret = timelineClient.SetWorkTime(worktimestart_, worktimeend_);
    sleep(10);
    EXPECT_FALSE(ret)<< "TimelineTestCallback034 fail to SetHomePosition";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback034: fun is end");
}

/**
 * @tc.name: TimelineTestCallback
 * @tc.desc: test GetForcecast
 * @tc.type: FUNC
 */
HWTEST_F (TimelineTest, TimelineTestCallback035, TestSize.Level0)
{
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback035: fun is start");
    auto& timelineClient = TimelineClient::GetInstance();
    auto ret = timelineClient.GetForcecast(24);
    EXPECT_TRUE(ret == TimelineDatabaseInfo::ForcecastPosition::UNKNOWN)<< "TimelineTestCallback035 fail to GetForcecast";
    TIMELINE_HILOGD(TIMELINE_MODULE_SERVICE, "TimelineTestCallback035: fun is end");
    //sleep(10);
}